#ifndef ExtPROM_H_
#define ExtPROM_H_


	#define DATAOUT 11//MOSI
	#define DATAIN  12//MISO 
	#define SPICLOCK  13//sck
	//int slaveSelectPin = 10; this is actually in the class definition

	//opcodes
	#define WREN  6
	#define WRDI  4
	#define RDSR  5
	#define WRSR  1
	#define READ  3
	#define WRITE 2

class ExtPROM {
	//uint8_t spi_transfer(volatile byte);
	uint8_t readByte(unsigned long);
	void writeByte(unsigned long, const uint8_t);
	int slaveSelectPin;

	public:
		void init(int);
		uint8_t readStatus();
		
		void writeLogPage(uint16_t, LogPage);
		LogPage readLogPage(uint16_t);
};

extern ExtPROM SpiPROM;

#endif